import { WidgetProps } from '@rjsf/utils';
import { ColorPicker } from 'antd';

export const ColorPickerWidget = ({
  value,
  onChange,
  disabled,
}: WidgetProps<string>) => {
  return (
    <ColorPicker
      disabled={disabled}
      defaultValue={value}
      disabledAlpha
      onChange={(value) => {
        onChange(value.toHexString());
      }}
    />
  );
};
